<template>
	<view class="bind-alipay">
		<scroll-view class="bind-alipay-view" scroll-y>
			<view class="bind-alipay-list" v-if="alipayList.length">
				<view class="bind-alipay-item" v-for="(data,index) in alipayList" :key="index">
					<view class="bind-alipay-item-info">
						<view>姓名 ：<text>刘先生</text></view>
						<view>支付宝账号 ：<text>469*********</text></view>
					</view>
					<view class="bind-alipay-item-del" @click="del(index)">删除</view>
				</view>
			</view>
			<nothing :text="'还未添加任何支付宝账号'" :btn="false" v-else></nothing>
		</scroll-view>
		<view class="bind-alipay-btn">
			<view @click="add()">添加支付宝账号</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				aliInfo: {},
				alipayList: []
			};
		},
		onShow() {
			this.otherFun()
		},
		methods: {
			otherFun(object){
				if(!!object){
					this.aliInfo = object
				}
			},
			add(){
				uni.navigateTo({
					url: '/pages/my/bind-alipay/bind-alipay-form'
				})
			},
			del(index){
				uni.showModal({
					content: '是否确认删除选择的案例?',
					success(res) {
						if(res.confirm){
							uni.showToast({
								icon: "none",
								title: "删除成功",
								duration: 1500
							})
							setTimeout(() => {
								_this.alipayList.splice(index,1)
							},1500)
						}
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.bind-alipay{
		.bind-alipay-view{
			position: fixed;
			bottom: 220rpx;
			top: 0;
			left: 0;
			right: 0;
			padding-top: 20rpx;
			.bind-alipay-item{
				margin-bottom: 20rpx;
				background-color: #FFF;
				padding: 20rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;
				.bind-alipay-item-info{
					view{
						font-size: 32rpx;
						line-height: 60rpx;
						text{
							color: #666;
						}
					}
				}
				.bind-alipay-item-del{
					color: #F91313;
					font-size: 32rpx;
				}
			}
		}
		.bind-alipay-btn{
			position: fixed;
			bottom: 60rpx;
			left: 75rpx;
			right: 75rpx;
			view{
				background-color: #2073F5;
				height: 100rpx;
				line-height: 100rpx;
				text-align: center;
				color: #FFF;
				border-radius: 100rpx;
				font-size: 36rpx;
			}
		}
	}
</style>